package com.boot.admin.modules.sys.ai.model.vo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * AI消息VO
 *
 * @author 李飞洋
 * @date 2025/9/24
 */
@Data
@EqualsAndHashCode
@ToString
public class AiMessageVO implements Serializable {
    @Schema(description = "id")
    private String id;

    @Schema(description = "创建时间")
    private LocalDateTime created;

    @Schema(description = "会话ID")
    private String conversationId;

    @Schema(description = "发送者类型 1:用户 2:AI")
    private Integer senderType;

    @Schema(description = "消息类型 1:文本 2:语音")
    private Integer messageType;

    @Schema(description = "消息内容")
    private String content;

    @Schema(description = "语音文件URL")
    private String audioUrl;

    @Schema(description = "语音时长(秒)")
    private Integer audioDuration;

    @Schema(description = "消息序号")
    private Integer messageIndex;

    @Schema(description = "是否启用")
    private Integer isEnabled;

    @Schema(description = "是否来自用户")
    public boolean isFromUser() {
        return senderType == 1;
    }

    @Schema(description = "是否来自AI")
    public boolean isFromAi() {
        return senderType == 2;
    }

    @Schema(description = "是否启用")
    public boolean isEnabled() {
        if (null == isEnabled) {
            return false;
        }
        return isEnabled == 1;
    }
}